<template>
<div class="text">
<textarea placeholder="按 Ctrl + Enter 或者 Shift + Enter 发送文本 
按 Ctrl + Shift + E 发送表情" v-model="content" @keyup="onKeyup"></textarea>
</div>
</template>

<script>
//import { actions } from '../store';
const actions = null;

export default {
    vuex: {
        actions: actions
    },
    data () {
        return {
            content: ''
        };
    },
    methods: {
        onKeyup (e) {
            let ctrlKey = e.ctrlKey && e.keyCode === 13 && this.content.length;
            let shiftKey = e.shiftKey && e.keyCode === 13 && this.content.length;
            if (ctrlKey  || shiftKey ) {
                this.sendMessage(this.content);
                this.content = '';
            }
        }
    }
};
</script>

<style lang="less" scoped>
.text {
    height: 160px;
    border-top: solid 1px #ddd;

    textarea {
        padding: 10px;
        height: 100%;
        width: 100%;
        border: none;
        outline: none;
        font-family: "Micrsofot Yahei";
        resize: none;
    }
}
</style>